# $Id$
# Maintainer: AndyRTR <andyrtr@archlinux.org>

pkgname=lpsolve
_origname=lp_solve
pkgver=5.5.2.5
_mainver=5.5
pkgrel=2
pkgdesc="a Mixed Integer Linear Programming (MILP) solver"
arch=('i686' 'x86_64')
url="http://lpsolve.sourceforge.net/"
license=('LGPL2.1')
depends=('glibc')
source=(http://downloads.sourceforge.net/project/lpsolve/lpsolve/${pkgver}/lp_solve_${pkgver}_source.tar.gz
        cflags.patch
        lpsolve-5.5.2.0.defines.patch)
sha1sums=('232ce8edb073c7c9b6d9100abf77038d989c45c8'
          '47285b11ef146ddb9aacfff982370ab7b0ea245e'
          'c4e61302072adcd27aba5d966e33fa001f3599e2')

prepare() {
  cd ${_origname}_${_mainver}
  # add CFLAGS
  patch -Np1 -i $srcdir/cflags.patch
  # by Fedora
  patch -Np1 -i $srcdir/lpsolve-5.5.2.0.defines.patch
}

build() {
  cd ${_origname}_${_mainver}

  # taken from Fedora spec
  cd lpsolve55
  sh -x ccc
#  rm bin/ux*/liblpsolve55.a
  cd ../lp_solve
  sh -x ccc
}

package() {
  cd ${_origname}_${_mainver}

  install -dm755 ${pkgdir}/usr/{bin,lib,include/lpsolve}
  install -m755 lp_solve/bin/ux*/lp_solve ${pkgdir}/usr/bin/
  install -m755 lpsolve55/bin/ux*/liblpsolve55.so ${pkgdir}/usr/lib/
  install -m644 lp*.h ${pkgdir}/usr/include/lpsolve/
}
